package com.cplatform.movie.back.sale.entity;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.json.JSONObject;

import org.codehaus.jackson.annotate.JsonProperty;

/**
 * 商品表
 * 
 * <p>
 * @author 左天宇
 * <p>
 * @package com.z.item.entity
 * <p>
 * @time 下午3:10:03 2015年5月31日
 */
@Entity
@Table(name = "T_SMALL_SHOP_ITEMS")
public class ItemSale implements Cloneable {
	
	public static Map<Long, String> postFlagMap = null;		// 是否需要物流
	public static Map<Long, String> auditStatusMap = null;	// 审核状态
	public static Map<Long, String> saleStatusMap = null;	// 上下架状态
	static {
		postFlagMap = new HashMap<Long, String>();
		postFlagMap.put(0l, "不需要");
		postFlagMap.put(1l, "需要");
		
		auditStatusMap = new HashMap<Long, String>();
		auditStatusMap.put(0l, "未审核");
		auditStatusMap.put(1l, "待审核");
		auditStatusMap.put(2l, "审核驳回");
		auditStatusMap.put(3l, "审核通过");
		
		saleStatusMap = new HashMap<Long, String>();
		saleStatusMap.put(0l, "未上架");
		saleStatusMap.put(1l, "已上架");
	}
	
	@SequenceGenerator(name = "seq_item", sequenceName = "SEQ_SMALL_SHOP_SEQ")
	@Id
	@GeneratedValue(generator = "seq_item")
	@JsonProperty
	private Long id;
	
	/** 是否需要物流配送 0-不需要物流配送 1-需要物流配送 **/
	@Column(name = "POST_FLAG", precision = 1, scale = 0)
	private Long postFlag;
	
	/** 销售有效开始时间 **/
	@Column(name = "SALE_START_TIME", length = 14)
	private String saleStartTime;

	/** 销售有效结束时间 **/
	@Column(name = "SALE_STOP_TIME", length = 14)
	private String saleStopTime;

	@Column(name = "STOCK_NUM", precision = 8, scale = 0)
	/** 商品库存数量 **/
	private Long stockNum;
	
	@Column(name = "USER_PER_BUY_NUM", precision = 8, scale = 0)
	/** 单个用户购买数量 0不限制 **/
	private Long userPerBuyNum;
	
	/** 商品状态 0--待审核  1--审核通过 2：审核驳回**/
	@Column(name = "STATUS", precision = 1, scale = 0)
	private Long status;
	
	/** 商品销售状态 0:未上架 1:已上架**/
	@Column(name = "SALE_STATUS")
	private Long saleStatus;
	
	/** 商品是否有效 0--无效 1--有效 **/
	@Column(name = "IS_VALID", precision = 1, scale = 0)
	private Long isValid;
	
	/** 市场价 **/
	@Column(name = "MARKET_PRICE", precision = 9, scale = 2)
	private Double marketPrice;
	
	/** 商品分类 **/
	@Column(name = "TYPE_ID", precision = 8, scale = 0)
	private Long typeId;
	
	/** 商品名称 */
	@Column(name = "NAME", length = 100)
	private String name;
	
	@Column(name = "SHORT_NAME", length = 100)
	/** 商品简称 */
	private String shortName;
	
	/** 温馨提示 */
	@Column(name = "WARM_PROMPT", length = 200)
	private String warmPrompt;
	
	@Column(name = "REMARK")
	/** 商品介绍 */
	private String remark;
	
	/** 更新时间 */
	@Column(name = "UPDATE_TIME", length = 14)
	private String updateTime;
	
	@Column(name = "BRAND", length = 20)
	/** 品牌 */
	private String brand;
	
	/** 重量 */
	@Column(name = "WEIGHT", precision = 8, scale = 2)
	private Double weight;

	/**商品创建时间*/
	private String createTime;
	
	/**商品创建人*/
	private Long createUserId;

	/**商品更新人*/
	private Long updateUserId;

	/**商品销售价格*/
	private Double shopPrice;

	/**商品封面图*/
	private String imgPath;
	
	/**运费 */
	private Double logisticsFee;
	
	/** 商户ID**/
	@Column(name = "STORE_ID")
	private Long storeId;

	@Column(name = "CREATE_TIME", length = 14)
	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	
	@Column(name = "CREATE_USER_ID", precision = 9, scale = 0)
	public Long getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(Long createUserId) {
		this.createUserId = createUserId;
	}
	
	@Column(name = "UPDATE_USER_ID", precision = 9, scale = 0)
	public Long getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(Long updateUserId) {
		this.updateUserId = updateUserId;
	}
	
	@Column(name = "SHOP_PRICE", precision = 9, scale = 2)
	public Double getShopPrice() {
		return shopPrice;
	}

	public void setShopPrice(Double shopPrice) {
		this.shopPrice = shopPrice;
	}
	
	@Column(name = "IMG_PATH", length = 200)
	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}
	

	
	@Column(name = "LOGISTICS_FEE", precision = 9, scale = 2)
	public Double getLogisticsFee() {
		return logisticsFee;
	}

	public void setLogisticsFee(Double logisticsFee) {
		this.logisticsFee = logisticsFee;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getPostFlag() {
		return postFlag;
	}

	public void setPostFlag(Long postFlag) {
		this.postFlag = postFlag;
	}

	public String getSaleStartTime() {
		return saleStartTime;
	}

	public void setSaleStartTime(String saleStartTime) {
		this.saleStartTime = saleStartTime;
	}

	public String getSaleStopTime() {
		return saleStopTime;
	}

	public void setSaleStopTime(String saleStopTime) {
		this.saleStopTime = saleStopTime;
	}

	public Long getStockNum() {
		return stockNum;
	}

	public void setStockNum(Long stockNum) {
		this.stockNum = stockNum;
	}

	public Long getUserPerBuyNum() {
		return userPerBuyNum;
	}

	public void setUserPerBuyNum(Long userPerBuyNum) {
		this.userPerBuyNum = userPerBuyNum;
	}

	public Long getStatus() {
		return status;
	}

	public void setStatus(Long status) {
		this.status = status;
	}

	public Long getIsValid() {
		return isValid;
	}

	public void setIsValid(Long isValid) {
		this.isValid = isValid;
	}

	public Double getMarketPrice() {
		return marketPrice;
	}

	public void setMarketPrice(Double marketPrice) {
		this.marketPrice = marketPrice;
	}

	public Long getTypeId() {
		return typeId;
	}

	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public String getWarmPrompt() {
		return warmPrompt;
	}

	public void setWarmPrompt(String warmPrompt) {
		this.warmPrompt = warmPrompt;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public Double getWeight() {
		return weight;
	}

	public void setWeight(Double weight) {
		this.weight = weight;
	}
	
	public Long getSaleStatus() {
		return saleStatus;
	}

	public void setSaleStatus(Long saleStatus) {
		this.saleStatus = saleStatus;
	}
	
	public Long getStoreId() {
		return storeId;
	}

	public void setStoreId(Long storeId) {
		this.storeId = storeId;
	}

	/** 商品创建结束时间*/
	@Transient
	private String createTimeEnd;
	/** 商品分类名称*/
	@Transient
	private String typeName;
	
	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getCreateTimeEnd() {
		return createTimeEnd;
	}

	public void setCreateTimeEnd(String createTimeEnd) {
		this.createTimeEnd = createTimeEnd;
	}
	
	@Override
	public String toString() {
		return JSONObject.fromObject(this).toString();
	}
}
